package es.armaplus.struts.actions.notas;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import es.armaplus.business.BusinessFactory;
import es.armaplus.business.ClienteBusiness;
import es.armaplus.business.NotaBusiness;
import es.armaplus.commons.Constantes;
import es.armaplus.dao.ClientesDao;
import es.armaplus.dao.DaoFactory;
import es.armaplus.dao.NotasDao;
import es.armaplus.struts.actions.BaseAction;
import es.armaplus.struts.forms.notas.NotasForm;

/**
 * Acci�n PRE-carga al formulario de alta de las notas.
 * @author Texaco
 *
 */
public class CrearNotaCliente extends BaseAction {

	private static final Log log = LogFactory.getLog(CrearNotaCliente.class);
	
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		log.debug(Constantes.METHOD_BEGIN);

		String idCliente = request.getParameter(Constantes.PARAM_ID_CLIENTE);

		NotasForm notasF = (NotasForm) form;
		
		ClienteBusiness clienteB = BusinessFactory.getBusiness(
				BusinessFactory.CLIENTE_BUSINESS);
		notasF.setCliente(clienteB.getCliente(Integer.valueOf(idCliente)));
		
		log.debug(Constantes.METHOD_END);
		return mapping.findForward(Constantes.FORWARD_SUCCESS);
	}

	
}
